package juc;

/**
 * 公平锁和非公平锁的展示
 */
public class Ticket {
    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(() -> {

            while (true) {
                if (Thread.currentThread().isInterrupted()) {
                    System.out.println("进程被打断");
                    break;
                }
                System.out.println("111111111111111");
            }

        });
        thread.start();

        Thread.sleep(1000L);
        new Thread(() -> {
            thread.interrupt();
        }).start();

    }

}
